# macOS构建器镜像
# 注意: macOS构建需要在macOS主机上运行,或使用macOS虚拟机
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# 安装基础工具
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    git \
    build-essential \
    python3 \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# 安装Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
    && apt-get install -y nodejs

# 安装xar和bomutils (用于处理pkg文件)
RUN apt-get update && apt-get install -y \
    libxml2-dev \
    libssl-dev \
    zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /builder

COPY builder.js ./
COPY package.json ./
RUN npm install

CMD ["node", "builder.js"]
